#pragma once
#include "RBTree.h"

namespace my_set {
	template<class K>
	class set {
	public:
		struct SetOfValue {
			const K& operator()(const K& value)
			{
				return value;
			}
		};
		//迭代器
		typedef typename RBTree<K, K, SetOfValue>::iterator iterator;
		iterator begin()
		{
			return _t.begin();
		}

		iterator end()
		{
			return _t.end();
		}
		bool insert(const K& key)
		{
			return _t.Insert(key);
		}
	private:
		RBTree<K, K, SetOfValue> _t;

	};

	void Test()
	{
		int a[] = { 4,2,6,1,3,5,15,7,16,14 };
		set<int> s;
		for (auto& e : a)
		{
			s.insert(e);
		}
		int x = 0;
	
	set<int>::iterator it = s.begin();
	while (it != s.end())
	{
		cout << *it << endl;
		++it;
	}
}
}
